#ifndef MACRO_H
#define MACRO_H

#define TEXT_COLOR_RED(STRING)    ("<font color=red>" + STRING + "</font>" "<font color=black> </font>")
#define TEXT_COLOR_BLUE(STRING)   ("<font color=blue>" + STRING + "</font>" "<font color=black> </font>")
#define TEXT_COLOR_GREEN(STRING)  ("<font color=green>" + STRING + "</font>" "<font color=black> </font>")
#define TEXT_COLOR_BLACK(STRING)  ("<font color=black>" + STRING + "</font>" "<font color=black> </font>")
#define TEXT_COLOR_WHITE(STRING)  ("<font color=white>" + STRING + "</font>" "<font color=black> </font>")

// --------------------------------------------
// 注册总线结构到全局
#include <QMetaType>
#include <QVector>

//add struct
struct itf_pkg{ //小端模式

    quint32 dst_dev;
    quint32 src_dev;
    char cmd_set[4];
    quint32 num_sum;
    quint32 num_cur;
    quint32 byt_sum;
    quint32 byt_val;
    quint32 usr_set;
    QByteArray data;
    quint8  chk_xor;
    quint8  chk_add;
    quint8  chk_crc;
    quint8  chk_end;
};
Q_DECLARE_METATYPE(itf_pkg)

struct itf_fil{ //小端模式
    quint32 id;
    quint32 size;
    quint32 addr[5]; //文件索引地址
    char type[4]; // "save" "load" "list"
    QByteArray data;

};
Q_DECLARE_METATYPE(itf_fil)

#define QDEBUG qDebug() << __FILE__ << __LINE__ << __func__
#define QDEBUG_WITH_PARAM(param) \
    #param << "=" << (param)
#endif // MACRO_H
